package csu.web.mypetstore.web.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import csu.web.mypetstore.domain.Account;
import csu.web.mypetstore.service.AccountService;

public class UserNameSearchServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String keyword1 = req.getParameter("keyword1");
        AccountService service = new AccountService();
        String result = service.SearchUser(keyword1);
        resp.setContentType("application/json");
        PrintWriter out = resp.getWriter();
        out.println(JSON.toJSONString(result));
    }
}